/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2022-10-03
 * Time:22:27
 */

/**
 * 力扣1784:检查二进制字符串字段
 */

public class checkOnesSegment {
    public boolean checkOnesSegment(String s) {
        boolean tip = false;
        //当1中间有0时false
        //当是连续的1时true
        for (char c : s.toCharArray()) {
            if (c == '0') {
                tip = true;
            } else if (c == '1' && tip) {
                return false;
            }
        }
        return true;
    }
}
